(function($, doc) {
	$.init();
	$.plusReady(function() {
		var extras=plus.webview.currentWebview().extras;
		if(extras==1){
			document.querySelector("#void").classList.remove("mui-hidden");
		}else if(extras==2){
			document.querySelector(".title span").innerText="待整改";
		}
	});
	
	//初始化滚动条
	mui(".mui-scroll-wrapper").scroll();
	
    //首页
	mui(".mui-bar").on("tap", ".com-to-home-btn", function () {
	    location.href = "home.html";
	});

	//更多
	mui(".mui-content").on("tap",".more",function(){
		document.querySelector(".more span").classList.toggle("mui-icon-arrowdown");
		document.querySelector(".more span").classList.toggle("mui-icon-arrowup");
		document.querySelector(".more_one").classList.toggle("mui-hidden");
		document.querySelector(".more_two").classList.toggle("mui-hidden");
	});
	setTimeout(function () {
//		defaultImg();
		setTimeout(function() {
			initImgPreview();
		}, 300);
	},500);
	//图片预览
	function initImgPreview() {
		var imgs = document.querySelectorAll("img.img");
		imgs = mui.slice.call(imgs);
		if (imgs && imgs.length > 0) {
			var slider = document.createElement("div");
			slider.setAttribute("id", "__mui-imageview__");
			slider.classList.add("mui-slider");
			slider.classList.add("mui-fullscreen");
			slider.style.display = "none";
			slider.addEventListener("tap", function() {
				slider.style.display = "none";
				setTimeout(function(){
					var a=document.querySelectorAll("textarea");
						a[0].blur();
				},4) 
				event.stopPropagation();
				event.preventDefault();
				return false;
			});
			slider.addEventListener("touchmove", function(event) {
				event.preventDefault();
			})
			var slider_group = document.createElement("div");
			slider_group.setAttribute("id", "__mui-imageview__group");
			slider_group.classList.add("mui-slider-group");
			imgs.forEach(function(value, index, array) {
				//给图片添加点击事件，触发预览显示；
				value.addEventListener('tap', function() {
					slider.style.display = "block";
					_slider.refresh();
					_slider.gotoItem(index, 0);
				})
				var item = document.createElement("div");
				item.classList.add("mui-slider-item");
				var a = document.createElement("a");
				var img = document.createElement("img");
				img.setAttribute("src", value.src);
				a.appendChild(img)
				item.appendChild(a);
				slider_group.appendChild(item);
			});
			slider.appendChild(slider_group);
			document.body.appendChild(slider);
			var _slider = mui(slider).slider();
		}
	}
})(mui, document);